<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <!--<th:block th:include="include :: header('新增附件')" />-->
    <th:block th:include="include :: header('文件上传')" />
    <th:block th:include="include :: bootstrap-fileinput-css" />
    <script type="text/javascript" src="/js/jquery-3.4.1.js"></script>
    <script type="text/javascript">
        function fileLoad(ele){
            var name = $(ele).val();
            var files = $(ele)[0].files[0];
            var start = name.lastIndexOf("\\");//获得字符串的开始位置
            //alert(name.substring(start+1));
            fileNameReal.value=name.substring(start+1);
        }
        $(function () {
            var $input =  $("#upLoad");
            // ①为input设定change事件
            $input.change(function () {
                //    ②如果value不为空，调用文件加载方法
                if($(this).val() != ""){
                    fileLoad(this);
                }
            })
        })
    </script>

</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-attachment-add">

            <div class="form-group">
                <label class="font-noraml">文件上传</label>
                <!--<div class="file-loading">-->
                    <!--<input id="cardFiles" type="file" class="file" multiple="multiple" data-show-preview="false">-->
                    <form name="form2" action="/fileUpload/upload_upload_03" method="post" enctype="multipart/form-data">
                        <input type="file" name="file_03" id="upLoad"><input type="submit" value="上传"/>
                    </form>
                <!--</div>-->
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">文件名</label>
                <div class="col-sm-8">
                    <input name="fileNameReal" id="fileNameReal" class="form-control" type="text">
                </div>
            </div>
            <!--<div class="form-group">    -->
                <!--<label class="col-sm-3 control-label">业务类型：</label>-->
                <!--<div class="col-sm-8">-->
                    <!--<select name="businessType" class="form-control m-b">-->
                        <!--<option value="">所有</option>-->
                    <!--</select>-->
                    <!--<span class="help-block m-b-none"><i class="fa fa-info-circle"></i> 代码生成请选择字典属性</span>-->
                <!--</div>-->
            <!--</div>-->
            <!--<div class="form-group">    -->
                <!--<label class="col-sm-3 control-label">业务Id：</label>-->
                <!--<div class="col-sm-8">-->
                    <!--<input name="businessId" class="form-control" type="text">-->
                <!--</div>-->
            <!--</div>-->
            <div class="form-group">    
                <label class="col-sm-3 control-label">文件路径：</label>
                <div class="col-sm-8">
                    <input name="filePath" class="form-control" type="text" value="E:\springUpload">
                </div>
            </div>

            <!--<div class="form-group">    -->
                <!--<label class="col-sm-3 control-label">显示用的文件名：</label>-->
                <!--<div class="col-sm-8">-->
                    <!--<input name="fileNameShow" class="form-control" type="text">-->
                <!--</div>-->
            <!--</div>-->
            <!--<div class="form-group">    -->
                <!--<label class="col-sm-3 control-label">文件大小：</label>-->
                <!--<div class="col-sm-8">-->
                    <!--<input name="fileSize" class="form-control" type="text">-->
                <!--</div>-->
            <!--</div>-->
            <!--<div class="form-group">    -->
                <!--<label class="col-sm-3 control-label">删除标记：</label>-->
                <!--<div class="col-sm-8">-->
                    <!--<input name="delFlag" class="form-control" type="text">-->
                <!--</div>-->
            <!--</div>-->
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <th:block th:include="include :: bootstrap-fileinput-js" />
    <script type="text/javascript">
        var prefix = ctx + "system/attachment"
        $("#form-attachment-add").validate({
            focusCleanup: true
        });

        function submitHandler() {
            if ($.validate.form()) {
                $.operate.save(prefix + "/add", $('#form-attachment-add').serialize());
            }
        }
    </script>
</body>
</html>